<template>
  <el-input v-bind="$attrs" v-model="model" class="w100 w-max100 number">
    <template #append v-if="appendText">
      {{ appendText }}
    </template>
    <template #prepend v-if="prependText">
      {{ prependText }}
    </template>
  </el-input>
</template>

<script>
  export default {
    name: 'bInput',
    props: {
      formValue: {
        type: [String, Number]
      },
      field: {
        type: String,
        default: ''
      }
    },
    computed: {
      model: {
        get() {
          return this.formValue
        },
        set(val) {
          this.$emit('changeData', { key: this.field, value: val, event: 'change' })
        }
      },
      appendText() {
        return this.$attrs.appendText || ''
      },
      prependText() {
        return this.$attrs.prependText || ''
      }
    }
  }
</script>
